package fr.afcepf.atod12.projet1.dao.tests;

import java.util.List;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

import fr.afcepf.atod12.projet1.dao.interfaces.IDaoTypeMedecin;
import fr.afcepf.atod12.projet1.entities.Medecin;
import fr.afcepf.atod12.projet1.entities.TypeMedecin;

import junit.framework.TestCase;



@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/springContextAnot.xml"})
@TransactionConfiguration(transactionManager="txManager",defaultRollback=false) 
@Transactional

public class TestTypeMedecin extends TestCase {

	@Autowired
	private IDaoTypeMedecin daoTypeMedecin;
	
	
	@Test
	public void GetAllType(){
		List<String> listeType = daoTypeMedecin.getAllSpecialite();
		System.out.println("Test getAllType");
		for(String type : listeType){
			System.out.println(type);
		}
		System.out.println("-----------------------");
	}

	@Test
	public void GetSpecialiteByMedecin(){
		List<TypeMedecin> listeType = daoTypeMedecin.getSpecialiteByMedecin(1);
		System.out.println("Test getAllSpecialiteByMedecin");
		for(TypeMedecin type : listeType){
			System.out.println(type.getSpecialite());
		}
		System.out.println("-----------------------");
	}

	@Test
	public void GetAllMedecinBySpecialite(){
		List<Medecin> listeMedecin = daoTypeMedecin.getAllMedecinBySpecialite(1);
		System.out.println("Test GetAllMedecinBySpecialite");
		for(Medecin type : listeMedecin){
			System.out.println(type);
		}
		System.out.println("-----------------------");
	}
}
